package {packageName}.{lowCaseClassName}.web;

import cn.mntool.parent.frame.response.EntityResult;
import cn.mntool.parent.frame.response.PageResult;
import cn.mntool.parent.frame.web.BaseController;
import {packageName}.{lowCaseClassName}.service.{upCaseClassName}Service;
import {packageName}.{lowCaseClassName}.web.ro.{upCaseClassName}CreateRo;
import {packageName}.{lowCaseClassName}.web.ro.{upCaseClassName}ModifyRo;
import {packageName}.{lowCaseClassName}.web.ro.{upCaseClassName}QueryRo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * describe: {tableComment}前端控制器
 *
 * @author {author}
 * @date {time}
 */
@RestController
@RequestMapping("/{lowCaseClassName}")
public class {upCaseClassName}Controller extends BaseController {
    @Autowired
    private {upCaseClassName}Service {lowCaseClassName}Service;

    @GetMapping("/query")
    public PageResult query({upCaseClassName}QueryRo {lowCaseClassName}QueryRo) {
        return success({lowCaseClassName}Service.query({lowCaseClassName}QueryRo));
    }

    @GetMapping("/load")
    public EntityResult load({upCaseClassName}QueryRo {lowCaseClassName}QueryRo) {
        return success({lowCaseClassName}Service.load({lowCaseClassName}QueryRo));
    }

    @PostMapping("/add")
    public EntityResult add(@Validated {upCaseClassName}CreateRo {lowCaseClassName}CreateRo) {
        {lowCaseClassName}Service.add({lowCaseClassName}CreateRo);
        return success();
    }

    @PostMapping("/edit")
    public EntityResult edit(@Validated {upCaseClassName}ModifyRo {lowCaseClassName}ModifyRo) {
        {lowCaseClassName}Service.update({lowCaseClassName}ModifyRo);
        return success();
    }

    @GetMapping("/delete")
    public EntityResult delete({upCaseClassName}ModifyRo {lowCaseClassName}ModifyRo) {
        {lowCaseClassName}Service.physicalDelete({lowCaseClassName}ModifyRo);
        return success();
    }
}
